1. Field of the Invention
The present invention generally relates to data processing and more particularly to building database queries with high level parameter markers that can be associated with a set of query conditions.
2. Description of the Related Art
Databases are computerized information storage and retrieval systems. A relational database management system is a computer database management system (DBMS) that uses relational techniques for storing and retrieving data. The most prevalent type of database is the relational database, a tabular database in which data is defined so that it can be reorganized and accessed in a number of different ways. A distributed database is one that can be dispersed or replicated among different points in a network. An object-oriented programming database is one that is congruent with the data defined in object classes and subclasses.
Regardless of the particular architecture, in a DBMS, a requesting entity (e.g., an application or the operating system) demands access to a specified database by issuing a database access request. Such requests may include, for instance, simple catalog lookup requests or transactions and combinations of transactions that operate to read, change and add specified records in the database. These requests are made using high-level query languages such as the Structured Query Language (SQL). Illustratively, SQL is used to make interactive queries for getting information from and updating a database such as International Business Machines' (IBM) DB2, Microsoft's SQL Server, and database products from Oracle, Sybase, and Computer Associates. The term “query” denominates a set of commands for retrieving data from a stored database. Queries take the form of a command language that lets programmers and programs select, insert, update, find out the location of data, and so forth.
Queries are constructed of query conditions that serve to filter results returned from the query. Accordingly, a query may be thought of as group of filters put together to sift out only the data in which they are interested. Often, it may be desirable to modify one or more of the query conditions and re-execute the query to determine the effects of the query condition on the results returned. Some high level query languages provide support for parameter markers which allow SQL statements to be generic and reused, allowing for easy modification.
The concept of parameter markers can be described with reference to the following simple query:Select*from employee Table where gender=‘M’The query returns a list of all male employees listed in a table employee Table. The query may be rewritten as:Select*from employee Table where gender=?The question mark replacing the ‘M’ represents a parameter marker and instructs the database engine that this specific value (for gender) will be provided later. By making this change, this single query can be used for selecting all the male employees or all the female employees, by setting the parameter marker to ‘M’ or ‘F’, respectively.
For some applications, such as data mining, trend analysis, and data warehouse exploration, it may be useful to substitute a group of conditions for a parameter marker, rather than just a value. For example, a medical researcher may be interested in the rate of occurrence of a particular disease in different categories of people (e.g., males vs. females, young vs. old, etc). In other words, the researcher may want to generate a query such as:Select*from patient_table where?The researcher may want to execute the query by substituting entire query conditions for the parameter marker (e.g., males between 20 and 30, females between 20 and 30, etc.) to gather data for, different groups of data. However, in contrast to the previous example, where a database engine could construct the entire query, absent the value field (‘M’ or ‘F’), in this example, the database engine would not be able to begin to construct the condition. Therefore, parameter markers have limitation on where they may be placed in a query, and the statement above would not be allowable.
In other words, conventional parameter markers may not be used for high level query criteria, such as entire query conditions or sets of query conditions. Therefore, there is a need for an improved method for building queries with high level parameter markers.